package com.ubs.web.diagnostic.imp;

import java.util.ArrayList;
import java.util.List;

import com.ubs.dom.Account;
import com.ubs.ejb.AccountControllerLocal;
import com.ubs.web.diagnostic.core.AbstractTestStep;
import com.ubs.web.diagnostic.core.TestStep;
import com.ubs.web.diagnostic.core.TestSuite;
import com.ubs.web.diagnostic.exception.DiagnosticException;

public class AccountControllerTestSuite implements TestSuite {
	
	@Override
	public String getSuiteName() {
		return "AccountController suite ";
	}

	private final TestStep accountBeanTest = new AbstractTestStep("AccountControllerBean obtaining") {
		
		@Override
		public void testBody() throws DiagnosticException {
			DiagnosticBeanFactory.getAccountControllerBean();
		}
	};

	private final TestStep createAccountTest = new AbstractTestStep("Account creation") {
		
		@Override
		public void testBody() throws DiagnosticException {
			AccountControllerLocal bean = DiagnosticBeanFactory.getAccountControllerBean();
			
			bean.registerAccount(new Account("test_account", "test_account", "Alex", "Box", "abox@list.ru"));
		}
	};

	private final TestStep findAccountTest = new AbstractTestStep("Account creation") {
		
		@Override
		public void testBody() throws DiagnosticException {
			AccountControllerLocal bean = DiagnosticBeanFactory.getAccountControllerBean();
			
			bean.loginAccount("test_account", "test_account");
		}
	};
	
	@Override
	public List<TestStep> getTestSteps() {
		List<TestStep> list = new ArrayList<TestStep>();
		
		list.add(accountBeanTest);
		
		list.add(createAccountTest);
		return list;
	}

}
